const express = require('express');
const router = express.Router();
const authController = require('../controllers/auth.controller');
const { registerRules, loginRules } = require('../middleware/validators');
const { authenticate } = require('../middleware/auth');

// 用户注册
router.post('/register', registerRules, authController.register);

// 用户登录
router.post('/login', loginRules, authController.login);

// 获取当前用户信息
router.get('/me', authenticate, authController.getCurrentUser);

// 登出
router.post('/logout', authenticate, authController.logout);

// 忘记密码请求
router.post('/forgot-password', authController.forgotPassword);

// 重置密码
router.post('/reset-password/:token', authController.resetPassword);

module.exports = router;